/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sdc;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

/**
 *
 * @author Don
 */
public class PostRenderer implements ListCellRenderer {
    
    private PostPanel panel;
    
    public PostRenderer() {
        this.panel = new PostPanel();
     }
    
    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        // Set the text
        this.panel.setText((Post)value);
        this.panel.setSelected(isSelected);
        //int width = list.getWidth();
        //if (width > 0) {
        //    this.panel.setCustomSize();
        //}
        // Return the panel
        return this.panel;
    }
}
